home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
mcmm.exe
/
Q_GUIDE.TXT
< prev
Wrap
Text File
|
1992-10-02
|
19KB
|
530 lines
Programmers Quick Guide to MCs Menu Maker v0.8
----------------------------------------------
Ok,so its not that quick a guide!,but there should be enough information here to
allow use of the menus/windows without any further documentation.
A list of all the functions that are necessary in order to create and maintain
a menu and/or window structure are listed below.Example code to illustrate each
call is also included,with a full working skeleton at the end of this
documentation.Note:If a window is linked to a menu then on being displayed it
will use its defaults however,if the window is displayed using window_show the
gadget values are taken from the windows work area and therefore must be set
first with win_set_item.Bascially if you *always* require the default values to
be used then link the window to a menu otherwise you have to manage the window
work area yourself (a demonstration of this in included at the end).
Cursor keys allow up/down movement on the menus while tab allows input to
circle around all a windows options.
void menu_clear(int 1)
----------------------
Parameter 1 is a number representing the main background screen colour to be
used.This function must be called first before any others as it contains code
to initialize the menu/window system.
Example:
--------
menu_clear(1);
Menu/window system will be initialized and main background colour will be 1,
standard EGA/VGA 16 colour scheme is used (see documentation for list).
void menu_declare(char *1)
--------------------------
This call allows each possible selection on a menu to be declared.To link a
particular option to a window the window number is contained in curly brackets
before the option.Window and menu numbers are assigned depending on the order of
declaration e.g. the first defined menu is menu 0 the second menu 1 etc, the
same applies to windows.
Example:
--------
menu_declare("A menu,{3}This option opens a window");
A menu will be defined,its number is dependant on if any other menus were
created before it (as the above is an example of the first menu declaration its
number will be 0).The first option in the menu will be the text "A menu" it has
no direct link to a window,on selection it will set the global variables
menu_option and menu_number,in this example both would equal 0 - for menu 0,
option 0 selected.The second option would insert the text "This option opens a
window",on selection window 3 would be openned and input would now be into this
window.Note,no menus are actually displayed until a menu_display is issued.
void window_declare(char *1,int 2,int 3,int 4,int 5,char *6)
------------------------------------------------------------
Allows a window to be defined.The order of declaration will define the window
number.All window declarations must end in a curly bracketed 0.Parameter 1
allows for an automatically centered window title to be displayed,if this is
left as a null ("") then no title will be displayed.Parameters 2 and 3 are the
windows size in characters (x,y).Parameters 4 and 5 determine the x,y coordinate
to place the window at,if both are 0 then the window is placed below and
slightly to the right (where ever possible) of the menu option that selected it.
If either value is not 0 then the window is placed directly at these coordinates
(origin top left 0,0).The final parameter 6 contains the window gadget types
required,currently supported types are listed below.Note all x,y coordinates
are relative to the windows origin.
type 1 text (x,y,col,string)
Parameters x,y are the coordinates to place the text at.Col is the
colour to use to display text and finally string is the actual text
itself.
Example:
--------
"{1}{10}{9}{15}Some text"
The text "Some text" will be displayed at coordinates 10,9 in colour
15.
type 2 switcher (x,y,num,def)
Parameters x,y are the coordinates to place the first switch at.Num is
the total number of switches displayed.Finally def is the number of the
default switch to be highlighted.
Example:
--------
"{2}{3}{4}{4}{2}"
4 switches will be displayed starting at coordinates 3,4,switch 2 is
the default hence highlighted one.
type 3 number (x,y,min,max,def)
Parameters x,y are the coordinates to place the input box.Min and Max
define the minimum and maximum value to accept.Def is the default
value.
Example:
--------
"{3}{10}{11}{5}{10}{6}"
An input box will displayed at coordinates 10,11,it will accept only
values between 5 and 10 inclusive.The default value is 6.
type 4 boolean (x,y,def)
Parameters x,y are the coordinates to place the alternator at.Def is
the default selection (1=Yes,0=No).
Example:
--------
"{4}{7}{4}{1}"
A boolean alternator will be displayed at coordinates 7,4.Its default
will be YES.
type 5 file (x,y,height,type)
Parameters x,y are the coordinates to place the start of the file box
at.Height is the height of the box in characters.Type defines what
action to take on a selection,(0=exit on selection of file to calling
program,1=don't,this allows for just directory selection).The current
directory will be used.
Example:
--------
"{5}{6}{7}{10}{0}"
A file selection box will be displayed at coordinates 6,7.Its height
will be 10 characters.On a file selection control will return to the
calling enviroment.
type 6 char (x,y,len,type,def)
Parameters x,y are the coordinates to place the start of the input box
at.Len is the maximum length of input string to accept.Type defines
what action to take on <return> being pressed,(0=normal, string is
stored but no action taken,1=exit on entry to calling program).Def is
the default string to be displayed.
Example:
--------
"{6}{17}{8}{10}{0}"
An input box will be displayed at coordinates 17,8.Maximum input length
of string will be 10 characters.On <return> no action will result,apart
from storage of the string.
type 7 accept (x,y,text)
Parameters x,y are the coordinates to place the icon at.Text is the
actual icon text to display.
Example:
--------
"{7}{6}{22}OK"
An icon will be displayed at coordinates 6,22.Its text will be "OK".
Full Example:
-------------
window_declare("A window",50,20,0,0,"{1}{2}{2}{9}Hi,{3}{2}{5}{2}{10}{5},{0}");
A window with title "A window" of size 50,20 will be declared.When displayed
it will appear one character down and one character to the right of the menu
option that selected it if possible.The text string "Hi" will be displayed in
colour 9 at coordinates 2,2.A number input box will be displayed at coordinates
2,5 it will accept a value between 2 and 10 inclusive,with the default displayed
value being 5.Note the {0} terminator.
int window_show(int 1,int 2,int 3)
----------------------------------
Window with the number parameter 1 will be displayed at coordinates parameter
2,parameter 3.This allows windows to be used without a menu selection being
made or without any menus at all.The returned value is either the ASCII code
of a 'non-window' key or a status value (see documentation).Note:default gadget
values are overwrote as any values are read from the gadgets work space.
Example:
--------
key=window_show(5,10,10);
Display window 5 at coordinates 10,10.
void window_help_declare(int 1,int 2,char *3)
---------------------------------------------
A window option must have a help string attached to it (null for none).
Parameter 1 defines which window the help is attached to.Parameter 2 defines
which gadget within that window the help is attached to.Parame